import type { Metadata } from 'next';
// import { AntdRegistry } from "@ant-design/nextjs-registry";
import { Inter } from 'next/font/google';
import { languages } from '@/i18n';
const inter = Inter({ subsets: ['latin'] });

import { dir } from 'i18next';
import { FC } from 'react';
import Head from 'next/head';

export async function generateStaticParams() {
	return languages.map((lng) => ({ lng }));
}

// 需要国际化配置 使用generateMetadata
export const metadata = {
	title: 'next-admin',
	description: 'Generated by 主页面',
	openGraph: {
		title: '这是我要分享的标题Next.js',
		description: 'The React Framework for the Web',
		url: 'https://nextjs.org',
		siteName: 'Next.js',
		images: [
			{
				url: 'https://nextjs.org/og.png', // Must be an absolute URL
				width: 800,
				height: 600
			},
			{
				url: 'https://nextjs.org/og-alt.png', // Must be an absolute URL
				width: 1800,
				height: 1600,
				alt: 'My custom alt'
			}
		],
		locale: 'en_US',
		type: 'website'
	}
};

type RootLayoutProps = {
	children: React.ReactNode;
	params: { lng: string };
};
// #----------- 上: ts类型定义 ----------- 分割线 ----------- 下: JS代码 -----------

const RootLayout: FC<RootLayoutProps> = ({ children, params: { lng } }) => {
	return (
		<html lang={lng} dir={dir(lng)}>
			<head>
				{/* 其他头部信息 */}
				<link rel="icon" href="/favicon.ico" type="image/x-icon" />
			</head>
			<body className="min-h-screen">
				<>{children}</>
			</body>
		</html>
	);
};

export default RootLayout;
